﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SLG.Domain.Strategy
{
    /// <summary>
    /// 默认的不对创造策略
    /// </summary>
    class DefaultArmyStrategy
    {   
        public static void Build(SLGDbContext dbContext, int serverId, int userId, Guid kingdomId, Guid cityId, Guid heroId, ref DateTime now)
        {
            EntRep<Entities.T_Army> aRep = new EntRep<Entities.T_Army>(dbContext);
            EntRep<Entities.T_Army_Unit> auRep = new EntRep<Entities.T_Army_Unit>(dbContext);

            Entities.T_Army army = new Entities.T_Army();
            army.Id = Guid.NewGuid();
            army.ServerId = serverId;
            army.UserId = userId;
            army.KingdomId = kingdomId;
            army.MarshalId = heroId;
            army.CityId = cityId;
            army.Number = 1000;
            army.FormationId = DEF.Formations.OneSnake;
            aRep.Create(army);

            Entities.T_Army_Unit unit = new Entities.T_Army_Unit();
            unit.Id = Guid.NewGuid();
            unit.Position = 0;
            unit.Number = 1000;
            unit.SoldierId = 1;
            unit.HeroId = heroId;
            unit.ArmyId = army.Id;
            auRep.Create(unit);
        }
    }
}
